-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intrinsify Array GetArrayDataReference for SZ arrays #87374
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsHandles SZ arrays passed to the
|
@MichalPetryka, can you describe the issue or link the issue? |
Described the motivation in the readme, worth noting is that I don't see any diffs in SPMI but I've seen examples of such code in the runtime, so I need to debug whether the type information is propagated correctly when inlining. |
@MichalPetryka So apparently jit-diff found zero diffs too, so can you explain again why exactly we need this, can you come up with a snippet that does a wrong thing and this PR fixes? |
It found some diffs now, the motivation here is that |
they don't look related, in fact it must be an unrelated issue @jakobbotsch fixed in #88385 |
They are related, look at the static method at the bottom of the file, not at the instance one. |
can you share it here? I don't see any diffs except the if <-> cmove ones |
Line 198 in 6d74424
|
So, basically, it improves just one method accross all libs, right? |
The API in question is relatively new and is intended to be used in high perf scenarios. The BCL not having light-up from it doesn't mean that external users won't benefit, particularly in the places where some libraries use MD arrays more prominently.
I think we should be taking changes, like this, that explicitly improve these "built-in"/"foundational" high-performance helper APIs, particularly when its done via We ultimately don't have tons of these lowlevel APIs with most being already covered. We're also not adding them in a way that isn't "pay for play". This recognition is all done on import and only for the APIs in question so the actual impact to the JIT is minimal and there isn't a lot of reason to not do them when they're this small. |
I doubt this non-generic
Nobody ever stated the otherwise, but in case of zero diff we need a solid proof it makes sense. It also means that the test coverage is only the test Michal just added (that also doesn't look complete - e.g. I don't see shared generic case).
Would be nice to see that UB in action, so far it was stated that this overload is unlikely to hit it. Overall I am ok taking this change, just wanted to raise a question regarding JIT changes without clear benefits/which don't fix any issues |
@MichalPetryka thanks! |
Handles SZ arrays passed to the
Array
typed GetArrayDataReference via the intrinsic path too.This should help JIT with avoiding UB caused by the C# implementation doing
Unsafe.As
on the array which can cause invalid codegen in some cases. Also makes the codegen a bit better.